var express = require('express')
var router = express.Router()
const { SysUserController } = require('../controller/sys_user')
const { auth } = require('./../middleware/auth')
const passport = require('passport')
/* GET users listing. */
router.get('/users/getCode', SysUserController.getCode)
router.post('/users/login', SysUserController.login)
router.post(
  '/users/add',
  passport.authenticate('jwt', { session: false }),
  auth,
  SysUserController.userAdd
)
router.put(
  '/users/edit',
  passport.authenticate('jwt', { session: false }),
  auth,
  SysUserController.userUpd
)
router.delete(
  '/users/del',
  passport.authenticate('jwt', { session: false }),
  auth,
  SysUserController.userDel
)
router.post(
  '/users/modify',
  passport.authenticate('jwt', { session: false }),
  auth,
  SysUserController.modifypwd
)
router.post(
  '/users/role',
  passport.authenticate('jwt', { session: false }),
  SysUserController.roleUser
)
router.post(
  '/users/userByDept',
  passport.authenticate('jwt', { session: false }),
  SysUserController.userByDept
)
module.exports = router
